package org.tong.base;

import lombok.Data;
import org.tong.validate.req.BookReq;

/**
 * @author
 * @date 2022-08-23 18:43
 */
@Data
public class Response<T> {

    private Boolean success;

    private T data;

    private String msg;

    public static <M> Response<M> success(M data) {
        Response<M> resp = new Response<M>();
        resp.setSuccess(true);
        resp.setData(data);
        return resp;
    }

    public static Response fail(String msg) {
        Response resp = new Response();
        resp.setSuccess(false);
        resp.setMsg(msg);
        return resp;
    }

    public static void main(String[] args) {
        Response<String> string = Response.success("String");

    }
}
